/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.diamondsys.embrapa;

import com.diamondsys.embrapa.util.JsfUtil;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Pablo
 */
@Entity
@Table(name = "sigif_eventosint")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "SigifEventosint.findAll", query = "SELECT s FROM SigifEventosint s ORDER BY s.eventointerno ASC"),
    @NamedQuery(name = "SigifEventosint.findByIdeventosint", query = "SELECT s FROM SigifEventosint s WHERE s.ideventosint = :ideventosint"),
    @NamedQuery(name = "SigifEventosint.findByEventointerno", query = "SELECT s FROM SigifEventosint s WHERE s.eventointerno = :eventointerno"),
    @NamedQuery(name = "SigifEventosint.findByDesObjetivoEvento", query = "SELECT s FROM SigifEventosint s WHERE s.desObjetivoEvento = :desObjetivoEvento"),
    @NamedQuery(name = "SigifEventosint.findByDatIniVig", query = "SELECT s FROM SigifEventosint s WHERE s.datIniVig = :datIniVig"),
    @NamedQuery(name = "SigifEventosint.findByDatFimVig", query = "SELECT s FROM SigifEventosint s WHERE s.datFimVig = :datFimVig"),
    @NamedQuery(name = "SigifEventosint.findByDesLocal", query = "SELECT s FROM SigifEventosint s WHERE s.desLocal = :desLocal"),
    @NamedQuery(name = "SigifEventosint.findByDesCidade", query = "SELECT s FROM SigifEventosint s WHERE s.desCidade = :desCidade"),
    @NamedQuery(name = "SigifEventosint.findByNumQtdPartic", query = "SELECT s FROM SigifEventosint s WHERE s.numQtdPartic = :numQtdPartic"),
    @NamedQuery(name = "SigifEventosint.findByHorIni", query = "SELECT s FROM SigifEventosint s WHERE s.horIni = :horIni"),
    @NamedQuery(name = "SigifEventosint.findByHorFim", query = "SELECT s FROM SigifEventosint s WHERE s.horFim = :horFim"),
    @NamedQuery(name = "SigifEventosint.findBySieve", query = "SELECT s FROM SigifEventosint s WHERE s.sieve = :sieve"),
    @NamedQuery(name = "SigifEventosint.findByEstado", query = "SELECT s FROM SigifEventosint s WHERE s.estado = :estado")})
public class SigifEventosint implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ideventosint")
    private Integer ideventosint;
    @Size(max = 100)
    @Column(name = "eventointerno")
    private String eventointerno;
    @Size(max = 200)
    @Column(name = "des_objetivo_evento")
    private String desObjetivoEvento;
    @Lob
    @Size(max = 2147483647)
    @Column(name = "des_obs")
    private String desObs;
    @Column(name = "dat_ini_vig")
    @Temporal(TemporalType.DATE)
    private Date datIniVig;
    @Column(name = "dat_fim_vig")
    @Temporal(TemporalType.DATE)
    private Date datFimVig;
    @Size(max = 100)
    @Column(name = "des_local")
    private String desLocal;
    @Size(max = 100)
    @Column(name = "des_cidade")
    private String desCidade;
    @Column(name = "num_qtd_partic")
    private Integer numQtdPartic;
    @Column(name = "hor_ini")
    @Temporal(TemporalType.TIME)
    private Date horIni;
    @Column(name = "hor_fim")
    @Temporal(TemporalType.TIME)
    private Date horFim;
    @Size(max = 2)
    @Column(name = "sieve")
    private String sieve;
    @Size(max = 100)
    @Column(name = "estado")
    private String estado;
    @JoinTable(name = "participante_evento", joinColumns = {
        @JoinColumn(name = "sigif_eventosint_ideventosint", referencedColumnName = "ideventosint")}, inverseJoinColumns = {
        @JoinColumn(name = "tb_inst_cod_instituicao", referencedColumnName = "cod_instituicao")})
    @ManyToMany
    private List<TbInst> tbInstList;

    public SigifEventosint() {
    }

    public SigifEventosint(Integer ideventosint) {
        this.ideventosint = ideventosint;
    }

    public Integer getIdeventosint() {
        return ideventosint;
    }

    public void setIdeventosint(Integer ideventosint) {
        this.ideventosint = ideventosint;
    }

    public String getEventointerno() {
        return eventointerno;
    }

    public void setEventointerno(String eventointerno) {
        this.eventointerno = eventointerno;
    }

    public String getDesObjetivoEvento() {
        return desObjetivoEvento;
    }

    public void setDesObjetivoEvento(String desObjetivoEvento) {
        this.desObjetivoEvento = desObjetivoEvento;
    }

    public String getDesObs() {
        return desObs;
    }

    public void setDesObs(String desObs) {
        this.desObs = desObs;
    }

    public Date getDatIniVig() {
        return datIniVig;
    }

    public void setDatIniVig(Date datIniVig) {
        this.datIniVig = datIniVig;
    }

    public String getDatIniVigString() {
        return JsfUtil.formatDate(datIniVig);
    }
    
    public Date getDatFimVig() {
        return datFimVig;
    }

    public String getDatFimVigString() {
        return JsfUtil.formatDate(datFimVig);
    }
    
    public void setDatFimVig(Date datFimVig) {
        this.datFimVig = datFimVig;
    }

    public String getDesLocal() {
        return desLocal;
    }

    public void setDesLocal(String desLocal) {
        this.desLocal = desLocal;
    }

    public String getDesCidade() {
        return desCidade;
    }

    public void setDesCidade(String desCidade) {
        this.desCidade = desCidade;
    }

    public Integer getNumQtdPartic() {
        return numQtdPartic;
    }

    public void setNumQtdPartic(Integer numQtdPartic) {
        this.numQtdPartic = numQtdPartic;
    }

    public Date getHorIni() {
        return horIni;
    }

    public void setHorIni(Date horIni) {
        this.horIni = horIni;
    }

    public Date getHorFim() {
        return horFim;
    }

    public void setHorFim(Date horFim) {
        this.horFim = horFim;
    }

    public String getSieve() {
        return sieve;
    }

    public void setSieve(String sieve) {
        this.sieve = sieve;
    }

    public String getEstado() {
        return estado;
    }

    public void setEstado(String estado) {
        this.estado = estado;
    }

    @XmlTransient
    public List<TbInst> getTbInstList() {
        return tbInstList;
    }

    public void setTbInstList(List<TbInst> tbInstList) {
        this.tbInstList = tbInstList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ideventosint != null ? ideventosint.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SigifEventosint)) {
            return false;
        }
        SigifEventosint other = (SigifEventosint) object;
        if ((this.ideventosint == null && other.ideventosint != null) || (this.ideventosint != null && !this.ideventosint.equals(other.ideventosint))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.diamondsys.embrapa.SigifEventosint[ ideventosint=" + ideventosint + " ]";
    }
    
}
